<%--
    Document   : index
    Created on : Aug 6, 2010, 5:40:12 PM
    Author     : hocvien
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        servlet.User user = new servlet.User();
        if(request.getCookies() != null)
        {
            Cookie[] lstCk = request.getCookies();
            for (int i = 0; i < lstCk.length; i++) {
                if (lstCk[i].getName().equals("username")) {
                    user.setUsername(lstCk[i].getValue());
                }
                if (lstCk[i].getName().equals("password")) {
                    user.setPassword(lstCk[i].getValue());
                }
            }
        }
        %>
        <form method="post" action="loginServlet">
            <table align="center">
                <tr>
                    <td colspan="2" align="center"><h3>Account Login</h3></td>
                </tr>
                <tr>
                    <td>Username :</td>
                    <td><input type="text" name="txtUsername" <% if (!user.nullString(user.getUsername()).equals("")) {%> value="<%=user.getUsername()%>"<%}%>/></td>
                </tr>
                <tr>
                    <td>Password :</td>
                    <td><input type="password" name="txtPassword" <% if (!user.nullString(user.getPassword()).equals("")) {%> value="<%=user.getPassword()%>"<%}%>/></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2"><input type="submit" name="btnSubmit" value="Submit"/></td>
                </tr>
            </table>
        </form>
    </body>
</html>
